home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / cachemon.zip / MONITOR.A86 < prev    next >
Text File  |  1990-03-11  |  2KB  |  72 lines

  1.                 jmp init
  2.  
  3. ;               Now the BIOS spying routines
  4.  
  5. old_handler     dw      ?,?
  6. signature       db      'CACHEMON 1.0 disk access monitor'
  7. read_count      dw      0,0
  8. read_sects      dw      0,0
  9. write_count     dw      0,0
  10. write_sects     dw      0,0
  11. my_id           db      80h
  12. more_sig        dw      0,1234h      ; will be 12345678h when running
  13. my_name         db      0,8 dup (' ')
  14.  
  15. main_entry:     ; called by INT 13h
  16.  
  17.                 push    ax
  18.                 pushf
  19.  
  20.              cs cmp     dl,my_id
  21.                 jne     main_exit
  22.  
  23.                 cmp     ah,02
  24.                 je      read02
  25.  
  26.                 cmp     ah,03
  27.                 je      write03
  28.  
  29. main_exit:
  30.                 popf
  31.                 pop     ax
  32.              cs jmp     far d[old_handler]
  33.  
  34. read02:
  35.                 cbw
  36.              cs add     read_sects,ax
  37.              cs adc     read_sects[2],0
  38.  
  39.              cs inc     read_count
  40.              cs adc     read_count[2],0
  41.  
  42.                 jmp     main_exit
  43.  
  44. write03:
  45.                 cbw
  46.              cs add     write_sects,ax
  47.              cs adc     write_sects[2],0
  48.  
  49.              cs inc     write_count
  50.              cs adc     write_count[2],0
  51.  
  52.                 jmp     main_exit
  53.  
  54. setup_int13:
  55.                 xor     ax,ax
  56.                 mov     es,ax
  57.              es les     bx,d[4*13h]     ; get old int 13 address
  58.                 mov     old_handler,bx
  59.                 mov     old_handler[2],es
  60.  
  61.                 mov     es,ax
  62.                 mov     bx,cs
  63.                 cli
  64.              es mov     w[4*13h],  offset main_entry  ; set us up as INT 13 ISR
  65.              es mov     w[4*13h+2],bx
  66.                 sti
  67.  
  68.                 mov     more_sig,5678h
  69.                 ret
  70.  
  71.  
  72.